package com.djmw.mouse.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Range;

@Entity
@Table(name = "t_company_trade")
public class CompanyTrade extends IdEntity {
	public static final int TYPE_DEPOSIT = 0;

	private Company company;
	private Date datetime;
	private int type;
	private double amount;

	public CompanyTrade() {
	}
	public CompanyTrade(Company company, Date datetime, int type, double amount) {
		this.company = company;
		this.datetime = datetime;
		this.type = type;
		this.amount = amount;
	}

	@ManyToOne
	@JoinColumn(name = "c_company_id")
	public Company getCompany() {
		return company;
	}
	public void setCompany(Company company) {
		this.company = company;
	}

	@Column(name = "c_datetime")
	public Date getDatetime() {
		return datetime;
	}
	public void setDatetime(Date datetime) {
		this.datetime = datetime;
	}

	@Range(min = 0, max = 100)
	@Column(name = "c_type")
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}

	@Column(name = "c_amount")
	public double getAmount() {
		return amount;
	}
	public void setAmount(double amount) {
		this.amount = amount;
	}
}
